-
Notifications
You must be signed in to change notification settings - Fork 136
fix: Fix transaction tag issue with blind-write #4243
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Summary of ChangesHello @sakthivelmanii, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request addresses a critical issue in the Spanner client library where transaction tags were not correctly propagated during blind-write operations within multiplexed sessions. The change introduces a temporary, SpanFE-recommended workaround to ensure these tags are included in the Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
|
/gemini review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request introduces a workaround to include a transaction tag in the BeginTransactionRequest for blind writes on multiplexed sessions. The change in SessionImpl.java correctly implements this logic. The accompanying test in DatabaseClientImplTest.java is a good addition, but it currently fails for non-multiplexed sessions because it unconditionally expects the transaction tag to be present. I've provided a suggestion to make the test assertion conditional based on whether a multiplexed session is being used, ensuring the test passes in both scenarios.
| .isEqualTo(transactionTag); | ||
| List<CommitRequest> commitRequests = mockSpanner.getRequestsOfType(CommitRequest.class); | ||
| assertThat(commitRequests).hasSize(1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test is part of a parameterized test suite that runs for both multiplexed and non-multiplexed sessions. The change in SessionImpl.java adds the transaction tag to the BeginTransactionRequest only for multiplexed sessions.
This assertion will fail when the test runs with multiplexed=false because the transaction tag will not be present in the BeginTransactionRequest. The test should conditionally check for the transaction tag based on whether the session is multiplexed.
List<BeginTransactionRequest> beginTransactionRequests = mockSpanner.getRequestsOfType(BeginTransactionRequest.class);
assertThat(beginTransactionRequests).hasSize(1);
if (isMultiplexed()) {
assertThat(beginTransactionRequests.get(0).getRequestOptions().getTransactionTag()).isEqualTo(transactionTag);
} else {
assertThat(beginTransactionRequests.get(0).getRequestOptions().getTransactionTag()).isEmpty();
}There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
The pull request effectively implements the temporary workaround for the transaction tag issue with blind-writes in multiplexed sessions, as described. The changes in SessionImpl.java correctly apply the transaction tag to the BeginTransactionRequest when applicable. The new test case testBlindWriteWithTransactionTag in DatabaseClientImplTest.java provides good coverage for this specific scenario, verifying that the tag is propagated as expected. Overall, the solution addresses the immediate problem and includes appropriate testing.
google-cloud-spanner/src/main/java/com/google/cloud/spanner/SessionImpl.java
Show resolved
Hide resolved
f4aba5a to
1b79a2c
Compare
Description:
Currently with the multiplexed session, SpanFE doesn't honor transaction tag for blind-write cases. Ideally this needs to be fixed in SpanFE which takes a long time. As a temporary workaround suggested by SpanFE, we are passing transaction tag in begin request to unblock beam release.
More details: b/461229444